/**
 * 
 */
package com.pos.widgets.taglist;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;

import com.pos.R;

/**
 * @description: 搜索历史标签列表
 * @author: jacky.cai
 * @time:2016年8月10日下午5:54:21
 */
public class SearchHistoryTagListView extends TagListView<String> {

	/**
	 * @param context
	 */
	public SearchHistoryTagListView(Context context) {
		super(context);
	}

	/**
	 * @param context
	 * @param attributeSet
	 */
	public SearchHistoryTagListView(Context context, AttributeSet attributeSet) {
		super(context, attributeSet);

	}

	/**
	 * @param context
	 * @param attributeSet
	 * @param defStyle
	 */
	public SearchHistoryTagListView(Context context, AttributeSet attributeSet, int defStyle) {
		super(context, attributeSet, defStyle);

	}

	@Override
	public void inflateTagView(String t, boolean b) {
		TagView localTagView = (TagView) View.inflate(getContext(), R.layout.tag, null);
		localTagView.setText(t);
		localTagView.setTag(t);
		localTagView.setTextColor(getResources().getColor(R.color.g499fff));
		if (mTagViewBackgroundResId <= 0) {
			mTagViewBackgroundResId = R.drawable.tag_bg;
			localTagView.setBackgroundResource(mTagViewBackgroundResId);
		}
		localTagView.setChecked(true);
		localTagView.setCheckEnable(b);
		localTagView.setOnClickListener(this);
		addView(localTagView);
	}

	@Override
	public void onClick(View v) {
		if ((v instanceof TagView)) {
			String localTag = (String) v.getTag();
			if (this.mOnTagClickListener != null) {
				this.mOnTagClickListener.onTagClick((TagView) v, localTag);
			}
		}
	}

}
